package com.communal.model.cr;

import java.io.Serializable;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.communal.model.tarif.TarifWaterCold;
import com.communal.model.tarif.TarifWaterHot;

/**
 * 
 * @author Created by andrey.kuznetsov <br>
 * @author Last modified by $Author$ <br>
 * @author Last modified on $Date$ at revision $Revision$ <br>
 */
@Entity
@Table(name = "water")
@AttributeOverrides({
	@AttributeOverride(name="id", column=@Column(name="id")),
	@AttributeOverride(name="enabled", column=@Column(name="enabled")),
	@AttributeOverride(name="month", column=@Column(name="month")),
	@AttributeOverride(name="year", column=@Column(name="year")),
	@AttributeOverride(name="date", column=@Column(name="date")),
	@AttributeOverride(name="summa", column=@Column(name="summa"))
})
@AssociationOverrides({
	@AssociationOverride( name="model", joinColumns = @JoinColumn(name="model_id"))
})
public class CRWater extends CommunalRecord implements Serializable{

	private static final long serialVersionUID = 4510689420191416021L;

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "tarif_cold_id")
	private TarifWaterCold tarifWaterCold;
	
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "tarif_hot_id")
	private TarifWaterHot tarifWaterHot;
	
	@Column(name = "currentValueCold", unique = false, nullable = false, insertable = true, updatable = true)
	private Short currentValueCold;
	
	@Column(name = "previousValueCold", unique = false, nullable = false, insertable = true, updatable = true)
	private Short previousValueCold;
	
	@Column(name = "currentValueHot", unique = false, nullable = false, insertable = true, updatable = true)
	private Short currentValueHot;
	
	@Column(name = "previousValueHot", unique = false, nullable = false, insertable = true, updatable = true)
	private Short previousValueHot;
	
	@Column(name = "summaCold", unique = false, nullable = false, insertable = true, updatable = true)
	protected Double summaCold;
	
	@Column(name = "summaHot", unique = false, nullable = false, insertable = true, updatable = true)
	protected Double summaHot;

	/**
	 * Returns tarif for cold water <br>
	 * @return {@link TarifWaterCold};
	 */
	public TarifWaterCold getTarifWaterCold() {
		return tarifWaterCold;
	}

	/**
	 * Sets tarif for cold water <br>
	 * @param p_tarifWaterCold - {@link TarifWaterCold};
	 */
	public void setTarifWaterCold(TarifWaterCold p_tarifWaterCold) {
		tarifWaterCold = p_tarifWaterCold;
	}

	/**
	 * Returns tarif for hot water <br>
	 * @return {@link TarifWaterHot};
	 */
	public TarifWaterHot getTarifWaterHot() {
		return tarifWaterHot;
	}

	/**
	 * Sets tarif for hot water <br>
	 * @param p_tarifWaterHot - {@link TarifWaterHot};
	 */
	public void setTarifWaterHot(TarifWaterHot p_tarifWaterHot) {
		tarifWaterHot = p_tarifWaterHot;
	}

	/**
	 * Returns current value on counter of cold water <br>
	 * @return {@link Short};
	 */
	public Short getCurrentValueCold() {
		return currentValueCold;
	}

	/**
	 * Sets current value on counter of cold water <br>
	 * @param p_currentValueCold - {@link Short};
	 */
	public void setCurrentValueCold(Short p_currentValueCold) {
		currentValueCold = p_currentValueCold;
	}

	/**
	 * Returns previous value on counter of cold water <br>
	 * @return {@link Short};
	 */
	public Short getPreviousValueCold() {
		return previousValueCold;
	}

	/**
	 * Sets previous value on counter of cold water <br>
	 * @param p_previousValueCold - {@link Short};
	 */
	public void setPreviousValueCold(Short p_previousValueCold) {
		previousValueCold = p_previousValueCold;
	}

	/**
	 * Returns current value on counter of hot water <br>
	 * @return {@link Short};
	 */
	public Short getCurrentValueHot() {
		return currentValueHot;
	}

	/**
	 * Sets current value on counter of hot water <br>
	 * @param p_currentValueHot - {@link Short};
	 */
	public void setCurrentValueHot(Short p_currentValueHot) {
		currentValueHot = p_currentValueHot;
	}

	/**
	 * Returns previous value on counter of hot water <br>
	 * @return {@link Short};
	 */
	public Short getPreviousValueHot() {
		return previousValueHot;
	}

	/**
	 * Sets previous value on counter of hot water <br>
	 * @param p_previousValueHot - {@link Short};
	 */
	public void setPreviousValueHot(Short p_previousValueHot) {
		previousValueHot = p_previousValueHot;
	}

	/**
	 * Returns summa to payment for cold water <br>
	 * @return {@link Double};
	 */
	public Double getSummaCold() {
		return summaCold;
	}

	/**
	 * Sets summa to payment for cold water <br>
	 * @param p_summaCold - {@link Double};
	 */
	public void setSummaCold(Double p_summaCold) {
		summaCold = p_summaCold;
	}

	/**
	 * Returns summa to payment for hot water <br>
	 * @return {@link Double};
	 */
	public Double getSummaHot() {
		return summaHot;
	}

	/**
	 * Sets summa to payment for hot water <br>
	 * @param p_summaHot - {@link Double};
	 */
	public void setSummaHot(Double p_summaHot) {
		summaHot = p_summaHot;
	}
	
	
}
